function [pw,  plambda] = derivative2D(w,  lambda,  p)
% Calculate the derivative of p with respect to both w and lambda at each
% grid point, where p is a matrix, with coordinate w by lambda.
N_w = numel(w);
N_lambda =  numel(lambda);

pw = zeros(N_w,N_lambda);
plambda = zeros(N_w,N_lambda);

for(  j = 1:N_lambda )
    pw(:,j) = derivative(  w,  p(:,j)  );
end

for(  i = 1:N_w )
    plambda(i,:) = derivative( lambda,  p(i,:)' )';
end




